﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        txtTenDN.Focus();
    }
    protected void btDangnhap_Click(object sender, EventArgs e)
    {
        try
        {

            DataTable dt = XLDL.Docbang("Select * From NhanVien where tendn='" + txtTenDN.Text + "' and matkhau='" + txtMatkhau.Text + "'");
            if (dt.Rows.Count != 0)
            {
                Session["tendn"] = txtTenDN.Text;
                Session["manv"] = dt.Rows[0]["manv"].ToString();
                Response.Redirect("~/Admin/adminsanpham.aspx");
            }
            else
                lbBaoloi.Text = "Tên đăng nhập không hợp lệ!";
        }
        catch
        {
            lbBaoloi.Text = "Thất bại!";
        }
    }
}